package com.example.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.dto.CartItemDto;
import com.example.dto.TradeDTO;
import com.example.dto.UpdatedItemDto;
import com.example.entity.CartInfo;
import com.example.vo.buyer.CartGroupedByStoreVo;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;

/**
* @author 朽
*/
public interface CartInfoService extends IService<CartInfo> {
    List<CartGroupedByStoreVo> getCartItemsByUserId(Long usCrId);

    boolean addCart(Long userId, CartItemDto cartItemDto);

    boolean updateByItemCheck(Long userId, Long id, Integer check);

    boolean updateByStoreCheck(Long userId, Long storeId, Integer check);

    boolean updateAllItemCheck(Long userId, Integer check);

    boolean updateCount(Long userId, Long id, Integer newQuantity);

    boolean deleteAllCart(Long userId);

    boolean deleteItemBySkuId(Long userId, Long skuId);

    boolean updateByItem(Long userId, UpdatedItemDto updatedItemDto) throws IOException;

    void asyncSyncCartWithDatabaseOnLogout(Long userId);

    TradeDTO settleOrder();

    List<CartGroupedByStoreVo> getCartFromRedis(Long userId);


    List<CartGroupedByStoreVo> getSelectedItemsByStore(List<CartGroupedByStoreVo> cartGroupedByStoreVos);

    BigDecimal calculateTotalPriceFromRedis(Long userId);
}
